<template>
	<view class="feedback">
		<view>
			<u-navbar title="意见反馈" :autoBack="true" placeholder></u-navbar>
			<view class="feedback feedback_item">
				<u--form class="custom-form" labelPosition="left" labelWidth="100" :labelStyle="formLabelStyle" :model="form"
					:rules="rules" ref="uForm" errorType="message">
					<u-form-item label="类型" borderBottom required>
						<u-radio-group v-model="form.type" placement="row">
							<u-radio activeColor="#0DA25F" label="投诉" :name="1" style="margin-right: 50px;"></u-radio>
							<u-radio activeColor="#0DA25F" label="其他" :name="2"></u-radio>
						</u-radio-group>
					</u-form-item>
					<u-form-item label="问题和意见" prop="content" required>
						<u--textarea v-model="form.content" class="textArea" placeholder="请输入问题和意见"></u--textarea>
					</u-form-item>
					<view style="padding: 0 4px;">
						<u-button type="primary" style="background-color: #0DA25F;color: #fff;border: none;border-radius: 45px;" class="button_submit" text="提交" @click="submit" :customStyle="{padding: 0}"></u-button>
					</view>
				</u--form>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from "vuex";
	import navConfig from './config/navConfig.js'
	import normalPagingConfig from './config/normalPagingConfig.js'
	import {
		userAddFile,
		feedbackAdd
	} from '@/service/index.js'

	export default {
		computed: {
			...mapState({
				userInfo: state => state.login.userInfo
			}),
		},
		data() {
			return {
				navConfig,
				normalPagingConfig,
				formLabelStyle: {
					fontSize: '12px',
					color: '#2D3338',
					paddingLeft: '12px',
				},
				// 校验规则
				rules: {
					content: [{
						required: true,
						message: '请输入问题和意见',
						trigger: ['blur']
					}]
				},
				form: {
					type: 1,
					title: '',
					content: '',
					blacklist: 0,
					phone: '',
					images: []
				}
			};
		},
		onLoad(options) {

		},
		onReady() {
			
		},
		methods: {
			async submit() {
				uni.showToast({
					title: '提交成功',
					icon: 'none'
				})
				this.resetForm()
			},
			resetForm() {
				this.form = {
					type: 1,
					title: '',
					content: '',
					blacklist: 0,
					phone: '',
					images: []
				}
				this.$refs.uForm.clearValidate()
			}
		}
	}
</script>

<style lang="scss">
	.feedback{
		background: #ededed;
		.feedback_item {
			background: #FFFFFF;
		}
	}
</style>